package priv.conceit.sc.hoxton.file.handle.source;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import priv.conceit.sc.hoxton.common.constant.file.FileSourceEnum;


/**
 * 文件源工厂
 *
 * @author Conceit
 * 2020/5/13 增加方法
 * @since 1.0.0, 2020/5/13
 */
@Component
public class SourceHandleFactory {

    @Autowired
    LocalSourceHandle localSourceHandle;

    @Autowired
    MinioSourceHandle minioSourceHandle;

    public AbsSourceHandle create(FileSourceEnum fileSourceEnum){
        switch (fileSourceEnum){
            case LOCAL:
              return  localSourceHandle;
            case MINIO:
              return  minioSourceHandle;
            default:
               //todo exception
              throw new IllegalArgumentException("Non SourceHandle");
        }
    }


}
